import { inject } from "vue";
import { ReturnTypeOfUseUserForm, useUserForm } from "./useUserForm";
import { USER_FORM_OPTION_LOGIC_STATE_KEY, USER_FORM_STATE_KEY } from "@/views/formgen/components/GenerateForm/types/constants";
import { ReturnTypeOfUseFormOptionLogic, useFormOptionLogic } from "./useFormOptionLogic";

export function useUserFormInject(): ReturnTypeOfUseUserForm {
  const store = inject<ReturnTypeOfUseUserForm>(USER_FORM_STATE_KEY);
  return store ?? useUserForm();
}

export function useUserFormOptionLogicInject(): ReturnTypeOfUseFormOptionLogic {
  const store = inject<ReturnTypeOfUseFormOptionLogic>(USER_FORM_OPTION_LOGIC_STATE_KEY);
  return store ?? useFormOptionLogic();
}
